<?php

/**
 * @author quang
 * @copyright 2011
 */

class SpeciesDal{
    function selectAll(){
        if (tep_db_checkDb()) {
            #if connect ok, insert into db
            $selectQuery = "select * from " . TBL_SPECIES;
            $arrSpecies = array();
            $result = tep_db_query($selectQuery);
            while($item = tep_db_fetch_array($result)){
                   $specy = new Species($item["content_en"], $item["content_fr"], $item["Img"]);
                   $specy->setId(intval($item["id"]));
                   array_push($arrSpecies, $specy);
            }
            return $arrSpecies;
        } else {
            # if not
            die('Cannot connect to database');
        }
    }
}

?>